﻿{extend name="public:base" /}

{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="row search-form">
                        <div class="col-sm-2 m-b-sm">
                            <select class="form-control" name="status">
                                <option value="0">请选择类型</option>
                                <option value="1" {:input('status') == 1 ? 'selected' : ''}>待审核</option>
                                <option value="2" {:input('status') == 2 ? 'selected' : ''}>已通过</option>
                                <option value="3" {:input('status') == 3 ? 'selected' : ''}>已驳回</option>
                            </select>
                        </div>

                        <div class="col-sm-2 m-b-sm">
                            <div class="input-group" style="width: 100%; display: flex; justify-content: space-between">
                                <button type="button" class="btn btn-primary btn-lg screen-btn">搜索</button>
                            </div>
                        </div>
                    </div>

                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>姓名</th>
                                <th>手机号</th>
                                <th>身份证号码</th>
                                <th>驾驶证号码</th>
                                <th>身份证正面</th>
                                <th>身份证反面</th>
                                <th>状态</th>
                                <th>驳回原因</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo.id}</td>
                                <td>{$vo.username}</td>
                                <td>{$vo.mobile}</td>
                                <td>{$vo.id_card}</td>
                                <td>{$vo.driver_license}</td>
                                <td>
                                    {if $vo.card_z}
                                    <div class="form-uploaded-img-box">
                                        <img class="form-uploaded-box-img" src="{$vo.card_z}">
                                        <i class="form-uploaded-img-preview iconfont icon-yulan" onclick="previewImg(this, 'form-uploaded-img-preview')"></i>
                                    </div>
                                    {/if}
                                </td>
                                <td>
                                    {if $vo.card_f}
                                    <div class="form-uploaded-img-box">
                                        <img class="form-uploaded-box-img" src="{$vo.card_f}">
                                        <i class="form-uploaded-img-preview iconfont icon-yulan" onclick="previewImg(this, 'form-uploaded-img-preview')"></i>
                                    </div>
                                    {/if}
                                </td>
                                <td>{$vo.status|getIdentStatus}</td>
                                <td>{$vo.remark}</td>
                                <td class="project-actions">
                                    {if $vo.status == 1}
                                    <a href="{:url(identAgree, ['id' => $vo.id])}" class="btn btn-white btn-sm ajax-operate"><i class="iconfont icon-success"></i> 通过
                                    </a>
                                    <div class="btn btn-white btn-sm" data-toggle="modal" data-target="#refuse" onclick="setId(`{$vo.id}`)">
                                        <i class="iconfont icon-refuse"></i> 驳回
                                    </div>
                                    {/if}
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {if !empty($list)}{$list->render()}{/if}
                    </div>

                </div>
            </div>
        </div>
    </div>

    <div class="modal inmodal" id="refuse" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated flipInY">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">驳回</h4>
                </div>
                <div class="modal-body">
                    <input type="text" class="form-control remark" placeholder="请输入驳回原因">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white close-model" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="confirmRefuse">确认修改</button>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/cropper-img-mask" cropper_uploaded_img_ids="cropper_uploaded_img_ids" cropper_uploaded_img_paths="cropper_uploaded_img_paths" crop_preview_box="crop-preview-box" /}{include file="public/preview-img-mask" swiper-id="cropper-preview" /}
{/block}

{block name="js"}
<script>
    var id = 0;

    function setId(row_id) {
        id = row_id
    }

    $('#confirmRefuse').click(function () {
        var remark = $('.remark').val();
        var url = "/admin/manage/identRefuse";

        $.post(url, {
            id, remark
        }, function (res) {
            layer.msg(res.msg)
            if (res.result == 1) {
                $(".close-model").trigger("click");
                setTimeout(() => {
                    window.location.reload()
                }, 500)
            }
        }, 'json')
    })
</script>
{/block}
